Unshift the group when extracting it from the X keyboard event.
authorOwen Taylor <otaylor@redhat.com>
Sat, 3 Mar 2001 19:57:54 +0000 (19:57 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 3 Mar 2001 19:57:54 +0000 (19:57 +0000)
Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>

* gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
the group when extracting it from the X keyboard event.

* modules/input/Makefile.am modules/input/imipa.c:
Simple module for entering IPA. (Do we need a
gtk-stupid-input-tricks CVS module?)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/x11/gdkevents-x11.c
modules/input/Makefile.am
modules/input/imipa.c [new file with mode: 0644]

index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 1e0221640c4e7b88fabd11b40ab46e78a600e9ca..27b701c63e24289dc509365e851ece7e91c5cbd7 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jan 22 14:31:29 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkevents-x11.c (gdk_event_translate): Unshift
+       the group when extracting it from the X keyboard event.
+
+       * modules/input/Makefile.am modules/input/imipa.c: 
+       Simple module for entering IPA. (Do we need a 
+       gtk-stupid-input-tricks CVS module?)
+
 Sat Mar  3 13:32:47 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkimmodule.c (gtk_im_module_init): Remove spurious
index 94153d7f643d2e0f7cc1a8f6deb5c9df3b4ede8a..0f590774c7d7dbf44c423faec814abbdfa390908 100644 (file)
@@ -596,6 +596,7 @@ gdk_event_translate (GdkEvent *event,
 #endif /* G_ENABLE_DEBUG */
 
       /* bits 13 and 14 in the "state" field are the keyboard group */
+#define KEYBOARD_GROUP_SHIFT 13
 #define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14))
       
       event->key.type = GDK_KEY_PRESS;
@@ -605,7 +606,7 @@ gdk_event_translate (GdkEvent *event,
       event->key.string = g_strdup (buf);
       event->key.length = charcount;
 
-      event->key.group = xevent->xkey.state & KEYBOARD_GROUP_MASK;
+      event->key.group = (xevent->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT;
       
       break;
       
index 725d4b4253c08d75bbeb934531ad5b5c79bb9898..354fd810d0285399fdf2325d1071b272d998bedc 100644 (file)
@@ -55,5 +55,8 @@ im_viqr_la_SOURCES = imviqr.c
 im_inuktitut_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module
 im_inuktitut_la_SOURCES = iminuktitut.c
 
+im_ipa_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module
+im_ipa_la_SOURCES = imipa.c
+
 module_LTLIBRARIES = im-cyrillic-translit.la $(IM_XIM_MODULE) im-viqr.la im-thai-broken.la \
-                     im-inuktitut.la
+                     im-inuktitut.la im-ipa.la
diff --git a/modules/input/imipa.c b/modules/input/imipa.c
new file mode 100644 (file)
index 0000000..2e98eb0
--- /dev/null
@@ -0,0 +1,180 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2000 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Owen Taylor <otaylor@redhat.com>
+ *
+ */
+
+#include <string.h>
+
+#include <gdk/gdkkeysyms.h>
+
+#include "gtk/gtkintl.h"
+#include "gtk/gtkimcontextsimple.h"
+#include "gtk/gtkimmodule.h"
+
+GType type_ipa = 0;
+
+static void ipa_class_init (GtkIMContextSimpleClass *class);
+static void ipa_init (GtkIMContextSimple *im_context);
+
+static void
+ipa_register_type (GTypeModule *module)
+{
+  static const GTypeInfo object_info =
+  {
+    sizeof (GtkIMContextSimpleClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) ipa_class_init,
+    NULL,           /* class_finalize */
+    NULL,           /* class_data */
+    sizeof (GtkIMContextSimple),
+    0,
+    (GtkObjectInitFunc) ipa_init,
+  };
+
+  type_ipa = 
+    g_type_module_register_type (module,
+                                GTK_TYPE_IM_CONTEXT_SIMPLE,
+                                "GtkIMContextIpa",
+                                &object_info, 0);
+}
+
+/* The sequences here match the sequences used in the emacs quail
+ * mode cryllic-translit; they allow entering all characters
+ * in iso-8859-5
+ */
+static guint16 ipa_compose_seqs[] = {
+  GDK_ampersand, 0,           0,      0,      0,      0x263,   /* LATIN SMALL LETTER GAMMA */
+  GDK_apostrophe, 0,          0,      0,      0,      0x2C8,   /* MODIFIER LETTER VERTICAL LINE */
+  GDK_slash,  GDK_apostrophe, 0,      0,      0,      0x2CA,   /* MODIFIER LETTER ACUTE ACCENT */
+  GDK_slash,  GDK_slash,      0,      0,      0,      0x02F,   /* SOLIDUS */
+  GDK_slash,  GDK_3,          0,      0,      0,      0x25B,   /* LATIN SMALL LETTER OPEN E */
+  GDK_slash,  GDK_A,          0,      0,      0,      0x252,   /* LATIN LETTER TURNED ALPHA */
+  GDK_slash,  GDK_R,          0,      0,      0,      0x281,   /* LATIN LETTER SMALL CAPITAL INVERTED R */
+  GDK_slash,  GDK_a,          0,      0,      0,      0x250,   /* LATIN SMALL LETTER TURNED A */
+  GDK_slash,  GDK_c,          0,      0,      0,      0x254,   /* LATIN SMALL LETTER OPEN O */
+  GDK_slash,  GDK_e,          0,      0,      0,      0x259,   /* LATIN SMALL LETTER SCHWA */
+  GDK_slash,  GDK_h,          0,      0,      0,      0x265,   /* LATIN SMALL LETTER TURNED H */
+  GDK_slash,  GDK_m,          0,      0,      0,      0x26F,   /* LATIN SMALL LETTER TURNED M */
+  GDK_slash,  GDK_r,          0,      0,      0,      0x279,   /* LATIN SMALL LETTER TURNED R */
+  GDK_slash,  GDK_v,          0,      0,      0,      0x28C,   /* LATIN SMALL LETTER TURNED V */
+  GDK_slash,  GDK_w,          0,      0,      0,      0x28D,   /* LATIN SMALL LETTER TURNED W */
+  GDK_slash,  GDK_y,          0,      0,      0,      0x28E,   /* LATIN SMALL LETTER TRUEND Y*/
+  GDK_3,      0,              0,      0,      0,      0x292,   /* LATIN SMALL LETTER EZH */
+  GDK_colon,  0,              0,      0,      0,      0x2D0,   /* MODIFIER LETTER TRIANGULAR COLON */
+  GDK_A,      0,              0,      0,      0,      0x251,   /* LATIN SMALL LETTER ALPHA */
+  GDK_E,      0,              0,      0,      0,      0x25B,   /* LATIN SMALL LETTER OPEN E */
+  GDK_I,      0,              0,      0,      0,      0x26A,   /* LATIN LETTER SMALL CAPITAL I */
+  GDK_L,      0,              0,      0,      0,      0x29F,   /* LATIN LETTER SMALL CAPITAL L */
+  GDK_M,      0,              0,      0,      0,      0x28D,   /* LATIN SMALL LETTER TURNED W */
+  GDK_O,      0,              0,      0,      0,      0x04F,   /* LATIN LETTER SMALL CAPITAL OE */
+  GDK_O,      GDK_E,          0,      0,      0,      0x276,   /* LATIN LETTER SMALL CAPITAL OE */
+  GDK_R,      0,              0,      0,      0,      0x280,   /* LATIN LETTER SMALL CAPITAL R */
+  GDK_U,      0,              0,      0,      0,      0x28A,   /* LATIN SMALL LETTER UPSILON */
+  GDK_Y,      0,              0,      0,      0,      0x28F,   /* LATIN LETTER SMALL CAPITAL Y */
+  GDK_grave,  0,              0,      0,      0,      0x2CC,   /* MODIFIER LETTER LOW VERTICAL LINE */
+  GDK_a,      0,              0,      0,      0,      0x061,   /* LATIN SMALL LETTER A */
+  GDK_a,      GDK_e,          0,      0,      0,      0x0E6,   /* LATIN SMALL LETTER AE */
+  GDK_c,      0,              0,      0,      0,      0x063,    /* LATIN SMALL LETTER C */
+  GDK_c,      GDK_comma,      0,      0,      0,      0x0E7,    /* LATIN SMALL LETTER C WITH CEDILLA */
+  GDK_d,      0,              0,      0,      0,      0x064,   /* LATIN SMALL LETTER E */
+  GDK_d,      GDK_apostrophe, 0,      0,      0,      0x064,   /* LATIN SMALL LETTER D */
+  GDK_d,      GDK_h,          0,      0,      0,      0x0F0,   /* LATIN SMALL LETTER ETH */
+  GDK_e,      0,              0,      0,      0,      0x065,   /* LATIN SMALL LETTER E */
+  GDK_e,      GDK_minus,      0,      0,      0,      0x25A,   /* LATIN SMALL LETTER SCHWA WITH HOOK */
+  GDK_e,      GDK_bar,        0,      0,      0,      0x25A,   /* LATIN SMALL LETTER SCHWA WITH HOOK */
+  GDK_g,      0,              0,      0,      0,      0x067,   /* LATIN SMALL LETTER G */
+  GDK_g,      GDK_n,          0,      0,      0,      0x272,   /* LATIN SMALL LETTER N WITH LEFT HOOK */
+  GDK_i,      0,              0,      0,      0,      0x069,   /* LATIN SMALL LETTER I */
+  GDK_i,      GDK_minus,      0,      0,      0,      0x268,   /* LATIN SMALL LETTER I WITH STROKE */
+  GDK_n,      0,              0,      0,      0,      0x06e,   /* LATIN SMALL LETTER N */
+  GDK_n,      GDK_g,          0,      0,      0,      0x14B,   /* LATIN SMALL LETTER ENG */
+  GDK_o,      0,              0,      0,      0,      0x06f,   /* LATIN SMALL LETTER O */
+  GDK_o,      GDK_minus,      0,      0,      0,      0x275,   /* LATIN LETTER BARRED O */
+  GDK_o,      GDK_slash,      0,      0,      0,      0x0F8,   /* LATIN SMALL LETTER O WITH STROKE */
+  GDK_o,      GDK_e,          0,      0,      0,      0x153,   /* LATIN SMALL LIGATURE OE */
+  GDK_o,      GDK_bar,        0,      0,      0,      0x251,   /* LATIN SMALL LETTER ALPHA */
+  GDK_s,      0,              0,      0,      0,      0x073,   /* LATIN SMALL LETTER_ESH */
+  GDK_s,      GDK_h,          0,      0,      0,      0x283,   /* LATIN SMALL LETTER_ESH */
+  GDK_t,      0,              0,      0,      0,      0x074,   /* LATIN SMALL LETTER T */
+  GDK_t,      GDK_h,          0,      0,      0,      0x3B8,   /* GREEK SMALL LETTER THETA */
+  GDK_u,      0,              0,      0,      0,      0x075,   /* LATIN SMALL LETTER U */
+  GDK_u,      GDK_minus,      0,      0,      0,      0x289,   /* LATIN LETTER U BAR */
+  GDK_z,      0,              0,      0,      0,      0x07A,   /* LATIN SMALL LETTER Z */
+  GDK_z,      GDK_h,          0,      0,      0,      0x292,   /* LATIN SMALL LETTER EZH */
+  GDK_bar,    GDK_o,          0,      0,      0,      0x252,   /* LATIN LETTER TURNED ALPHA */
+
+  GDK_asciitilde, 0,          0,      0,      0,      0x303,    /* COMBINING TILDE */
+
+};
+
+static void
+ipa_class_init (GtkIMContextSimpleClass *class)
+{
+}
+
+static void
+ipa_init (GtkIMContextSimple *im_context)
+{
+  gtk_im_context_simple_add_table (im_context,
+                                  ipa_compose_seqs,
+                                  4,
+                                  G_N_ELEMENTS (ipa_compose_seqs) / (4 + 2));
+}
+
+static const GtkIMContextInfo ipa_info = { 
+  "ipa",                  /* ID */
+  N_("IPA"),                       /* Human readable name */
+  "gtk+",                         /* Translation domain */
+   GTK_LOCALEDIR,                 /* Dir for bindtextdomain (not strictly needed for "gtk+") */
+  ""                              /* Languages for which this module is the default */
+};
+
+static const GtkIMContextInfo *info_list[] = {
+  &ipa_info
+};
+
+void
+im_module_init (GTypeModule *module)
+{
+  ipa_register_type (module);
+}
+
+void 
+im_module_exit (void)
+{
+}
+
+void 
+im_module_list (const GtkIMContextInfo ***contexts,
+               int                      *n_contexts)
+{
+  *contexts = info_list;
+  *n_contexts = G_N_ELEMENTS (info_list);
+}
+
+GtkIMContext *
+im_module_create (const gchar *context_id)
+{
+  if (strcmp (context_id, "ipa") == 0)
+    return GTK_IM_CONTEXT (gtk_type_new (type_ipa));
+  else
+    return NULL;
+}